
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import javax.microedition.lcdui.game.TiledLayer;

public class Level{
    
  static byte[][] levelMap;
  static int tiles_w;
  static int tiles_h;
  static final int RASTER=32; //Größe eines Tiles: 32x32
  static Image Tiles;
  static TiledLayer Tl;
  
  

  

  public static void generateMap(int level_nr, Graphics g){
        
    if (level_nr==1){
      //tiles_w=30;
      //tiles_h=30;     
      try{
      Tiles = Image.createImage("/tiles.png");
      } catch (Exception e) {g.drawString("FEHLER     !", 100,10, Tb.anchor);}
      try{g.drawImage(Tiles, Tb.w, Tb.h, Tb.anchor);}
      catch(Exception e){g.drawString("FEHLER    2", 100,10, Tb.anchor);}
      try{ TiledLayer Tl = new TiledLayer(11,11,Tiles,32,32);}catch(Exception e){g.drawString("FEHLER    3", 100,10, Tb.anchor);}
       try{for (int i = 0; i< Tl.getColumns(); i++)
       {  //spalten ueberpruefen
    	   for(int y = 0 ; y < Tl.getRows(); y++){
    	        //reihen ueberpruefen
    		  try{ Tl.setCell(i, y, 0);}
    		  catch(Exception e){g.drawString("FEHLER  6", 100,10, Tb.anchor);}
    	   }
       }}catch(Exception e){g.drawString("FEHLER5", 100,10, Tb.anchor);}
    }
    try{ Tl.paint(g);}catch(Exception e){g.drawString("FEHLER 4", 100,10, Tb.anchor);}
       
    }
    
  }
  
  
